// Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.

// api路由定义
package api

import (
	"github.com/beego/beego/v2/server/web"

	"scase.io/application-auto-scaling-service/pkg/api/controller"
)

func initRouters() {
	// pod routers
	web.Router("/v1/:project_id/instance-pod-groups", &controller.PodController{}, "post:CreatePodGroup;get:ListPodGroup")
	web.Router("/v1/pod/:host_name", &controller.PodController{}, "get:GetPodInfo")
	web.Router("/v1/:project_id/instance-pod-groups/:instance_pod_group_id",
		&controller.PodController{}, "delete:DeletePodGroup;get:GetPodGroup")
	web.Router("/v1/:project_id/instance-pod-groups", &controller.PodController{}, "post:CreatePodGroup")

	// instance scaling group routers
	web.Router("/v1/:project_id/instance-scaling-groups", &controller.ECSController{}, "post:CreatePrePaidECSGroup;get:ListScalingGroup")
	web.Router("/v1/:project_id/instance-scaling-groups/:instance_scaling_group_id",
		&controller.ECSController{}, "put:UpdatePrePaidECSGroup;delete:DeleteScalingGroup;get:GetScalingGroup")
	web.Router("/v1/instance-scaling-groups/:instance_scaling_group_id/instance-configuration",
		&controller.ScalingGroupController{},
		"get:GetInstanceConfigOfScalingGroup")
	web.Router("/v1/scaling-groups/:fleet_id/configuration",
		&controller.ScalingGroupController{}, "get:GetScalingGroupConfig")
	// scaling policy routers
	web.Router("/v1/:project_id/scaling-policies", &controller.ScalingPolicyController{},
		"post:CreateScalingPolicy;get:GetBindRelation")
	web.Router("/v1/:project_id/scaling-policies/:scaling_policy_id", &controller.ScalingPolicyController{},
		"delete:DeleteScalingPolicy;put:UpdateScalingPolicy")
	web.Router("/v1/:project_id/scaling-policies/:scaling_policy_id/bind", &controller.ScalingPolicyController{},
		"put:BindingPolicy;delete:UnBindingPolicy")
	// scaling instances routers
	web.Router("/v1/:project_id/monitor-instances", &controller.ECSController{}, "get:ListInstance")

	// lts
	web.Router("/v1/:project_id/list-lts-access-config", &controller.LTSController{}, "get:ListAccessConfig")
	web.Router("/v1/:project_id/lts-access-config", &controller.LTSController{},
		"post:CreateAccessConfig;delete:DeleteAccessConfig;get:QueryAccessConfig;put:UpdateAccessConfig")
	web.Router("/v1/:project_id/lts-update-host", &controller.LTSController{}, "put:UpdateHost")
	web.Router("/v1/:project_id/list-lts-log-group", &controller.LTSController{}, "get:ListLogGroups")
	web.Router("/v1/:project_id/lts-log-group", &controller.LTSController{}, "post:CreateLogGroup")
	web.Router("/v1/:project_id/lts-log-stream", &controller.LTSController{}, "get:ListLogStream")
	web.Router("/v1/:project_id/lts-transfer", &controller.LTSController{},
		"post:CreateLogTransfer;get:QureyTransfer;delete:DeleteLogTransfer;put:UpdateLogTransfer")
	web.Router("/v1/:project_id/list-lts-transfer", &controller.LTSController{}, "get:ListLogTransfer")

	// ecs
	web.Router("/v1/:project_id/pre-paid-ecs", &controller.ECSController{}, "post:CreatePrePaidECSGroup;get:ListScalingGroup")
	web.Router("/v1/:project_id/pre-paid-ecs/:instance_scaling_group_id", &controller.ECSController{}, "put:UpdatePrePaidECSGroup;delete:DeleteScalingGroup")
	web.Router("/v1/:project_id/pre-paid-ecs/instance", &controller.ECSController{}, "get:ListInstance")

	// event
	web.Router("/v1/:project_id/event", &controller.EventController{}, "post:Create;get:List")
	web.Router("/v1/:project_id/event/:event_id", &controller.EventController{}, "get:Show;delete:Delete")
	web.Router("/v1/:project_id/topic", &controller.EventController{}, "post:CreateTopic;delete:DeleteTopic;get:ShowTopic;put:UpdateTopic")
	web.Router("/v1/:project_id/topic/subscriptions/:topic_urn", &controller.EventController{}, "post:AddSubscription")
	web.Router("/v1/:project_id/topic/subscriptions/:subscription_urn", &controller.EventController{}, "delete:CancelSubscription")

	// agency info
	web.Router("/v1/agency", &controller.ECSController{}, "post:AddAgencyInfo")
}
